import { NgModule } from '@angular/core';
import { RouterModule, NavigationEnd, Router } from '@angular/router';
import { MySalaryComponent } from './my-salary/my-salary.component';
import { SalaryManageComponent } from './slary-manage/salary-manage.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    { path: 'my-salary', component: MySalaryComponent }
                ]
            },
            {
                path: '',
                children: [
                    { path: 'salary-manage', component: SalaryManageComponent }
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class SalaryRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
